<template>
    <div>
        <CommonContainer title="准入结果">
            <template v-slot:rightInfo>
                <div class="rightInfo" @click="goHistoryCreditRecord">查看客户历史信审记录</div>
            </template>
            <el-form ref="accessForm" :model="form" label-width="120px" :rules="rules">
                <el-form-item label="准入/不予准入:" prop="creditReviewStatus">
                    <el-radio-group v-model="form.creditReviewStatus">
                        <el-radio :label="3">准入</el-radio>
                        <el-radio :label="10">不予准入</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item v-if="form.creditReviewStatus==10" label="说明:" prop="remark">
                    <el-input type="textarea" v-model="form.remark" placeholder="请输入不予准入说明"></el-input>
                </el-form-item>
            </el-form>
        </CommonContainer>
        <history-credit-record ref="historyCreditRecord"></history-credit-record>
    </div>
</template>

<script>

import {access} from '@/api/letterReview/letterReview'
import HistoryCreditRecord from "@/views/letterReview/letterReview/components/HistoryCreditRecord.vue";
export default {
    components: {HistoryCreditRecord},
    props: ['customerNo'],
    data() {
        // 这里存放数据
        return {
            form:{
                id:this.$route.query.id,
                creditReviewStatus:3,
                remark:null
            },
            rules: {
                creditReviewStatus: [
                    {required: true, message: '请选择是否允许准入', trigger: 'change'},
                ],
                remark: [
                    {required: true, message: '请输入说明', trigger: 'change'},
                ]
            }
        }
    },
    // 方法集合
    methods: {
        goHistoryCreditRecord(){
            this.$refs.historyCreditRecord.show(this.customerNo)
        },
        saveSubmit() {
            this.$refs['accessForm'].validate((valid) => {
                if (valid) {
                    access(this.form).then((res) => {
                        this.$message.success('提交成功')
                        this.$router.back()
                    })
                }
            })
        }
    },
    // 生命周期 - 挂载完成（可以访问 DOM 元素）
    mounted() {
    },

}
</script>

<style lang="scss" scoped>
.rightInfo{
    font-size: 14px;
    color: #1890FF;
}
</style>
